Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use scipy and pandas for OutOfAfricaExtendedNeandertalAdmixture… #1416

Merged
merged 4 commits into from
Nov 9, 2022

Conversation

grahamgower
Copy link
Member

…Pulse_3I21

  • Scipy was being used for the Gamma PDF, which has been reimplemented using the math.gamma() function.
  • Pandas use here was unnecessary, so has been removed.

…Pulse_3I21

* Scipy was being used for the Gamma PDF, which has been reimplemented
  using the math.gamma() function.
* Pandas use here was unnecessary, so has been removed.
@grahamgower
Copy link
Member Author

grahamgower commented Nov 7, 2022

I haven't removed pandas and scipy bits from the QC model, because we want to test that my changes don't actually change the model at all. But this leaves us with still needing scipy and pandas at runtime, because the QC models are loaded during import stdpopsim. :(

Actually, I don't think we should be loading the QC models in stdpopsim/__init__.py, but I'm not sure the current scope of how these are used. We could instead import stdpopsim.qc from tests/__init__.py, which will ensure the QC models are used in testing. But the cli also uses QC models to only show help output for models that are QCed warn users the model hasn't been QCed. I didn't check elsewhere to see if QC models might be used at runtime.

@grahamgower
Copy link
Member Author

Codecov upload failures. 😩

@jeromekelleher
Copy link
Member

Thanks @grahamgower - agreed with all the above!

@petrelharp
Copy link
Contributor

Me too - seems tricky!

@codecov
Copy link

codecov bot commented Nov 8, 2022

Codecov Report

Base: 99.94% // Head: 99.94% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (22075bf) compared to base (d2e4371).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1416      +/-   ##
==========================================
- Coverage   99.94%   99.94%   -0.01%     
==========================================
  Files         109      109              
  Lines        3820     3807      -13     
  Branches      524      529       +5     
==========================================
- Hits         3818     3805      -13     
  Misses          1        1              
  Partials        1        1              
Impacted Files Coverage Δ
stdpopsim/catalog/HomSap/demographic_models.py 100.00% <100.00%> (ø)
stdpopsim/qc/HomSap.py 100.00% <100.00%> (ø)
stdpopsim/utils.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jeromekelleher
Copy link
Member

We should totally not be importing the qc models at runtime unless specifically requested - would be happy to help with workarounds to get them out of the import stdpopsim code flow

@grahamgower
Copy link
Member Author

We should totally not be importing the qc models at runtime unless specifically requested - would be happy to help with workarounds to get them out of the import stdpopsim code flow

I think I'd rather have that as a separate PR, and I've opened #1418 to discuss/track.

Maybe for this PR, you'd be happy to look at the CI runs and satisfy yourself that I haven't changed the demographic model (the QC test still passes)? I can then push another commit making the analogous change to remove scipy/pandas from the QC model.

@grahamgower
Copy link
Member Author

One additional point: time python -c 'import stdpopsim' takes about 1 second; after removing pandas/scipy from the import path, this drops to 500 ms. Loading the QC models (or not) makes negligible difference to import time once pandas/scipy is removed.

@grahamgower
Copy link
Member Author

This is good to go now @jeromekelleher.

Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants